package Demo.demo5;

public class Food {
    private String foodName;  // 食物的名称
    private double foodPrice;  // 价格
    private String foodKind;  // 猫粮、狗粮

    public Food(String foodName, double foodPrice, String foodKind) {
        this.foodName = foodName;
        this.foodKind = foodKind;
        this.setFoodPrice(foodPrice);
    }

    public String getFoodName() {
        return foodName;
    }

    public void setFoodName(String foodName) {
        this.foodName = foodName;
    }

    public double getFoodPrice() {
        return foodPrice;
    }

    public void setFoodPrice(double foodPrice) {
        if (foodPrice >= 0) this.foodPrice = foodPrice;
    }

    public String getFoodKind() {
        return foodKind;
    }

    public void setFoodKind(String foodKind) {
        this.foodKind = foodKind;
    }
}